<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class Cate extends Base
{
    protected $hidden = ['created_at','updated_at'];

    public static function add($map)
    {
        //判断是否存在改项分类
        $rew = self::where('name',$map['name'])
            ->where('cate',$map['cate'])
            ->get();
        if($rew->isEmpty()){
            $result = self::create($map);
            if($result){
                return 200;
            }
        }else{
            return 400;
        }
    }
}
